-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement new Wikimedia mobile end-point support/render #1903
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1903 +/- ##
==========================================
+ Coverage 74.60% 76.14% +1.53%
==========================================
Files 33 37 +4
Lines 2812 2985 +173
Branches 626 653 +27
==========================================
+ Hits 2098 2273 +175
+ Misses 618 617 -1
+ Partials 96 95 -1
☔ View full report in Codecov by Sentry. |
This patch is not ready for the review yet. I found that article treatments are not working for mobile as I expected first. I pushed preliminary commit b7f6e55 to pass output from |
Current implementation of mobile-html render has additional treatments:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Architecture looks good but a few details to fix to keep things lean.
Important now, is to get all the tests passing so we can make the final review.
6e2d33c
to
251b6bb
Compare
Set this to the review. To secure tests I explicitly set |
@VadimKovalenkoSNF Great, do we have anything know not working fine specificily with this new end-point and which would need further work (and an other ticket)? |
@kelson42 collapsible sections not working (don't mismatch this with collapsible infoboxes) + I want you to look at the HTML output and give me feedback about it ( mostly form a user perspective ). Note that |
I noticed that images in gallery box don't render and |
This is essential that both bugs are fixed |
@kelson42 , I created a separate test file Download this patch and run: Output that I received:
And the error about invalid internal links:
I would appreciate your input about how to solve this. Is there any effort required for zimcheck itself to fix this. Or is this only a mwoffliner issue? Link rels seems to work as expected. List of external resources that needed for mobile renderer can be found here - https://en.wikipedia.org/api/rest_v1/page/mobile-html-offline-resources/Canada * |
@VadimKovalenkoSNF All internal links pointing to articles which are not mirrored should be removed. Wonder why this one is not!. External links are OK but external resources obviously not. They ahve to be locally mirrored. |
This one has been fixed, I mirrored mobile modules on the right way now.
And this one doesn't seem to be related to the mobile renderer. It works depending on the article title, I left a comment here, maybe this should be highlighted in a separate ticket. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed them. If there is anything else for removal, I prepared a separate res/pcs/pcs_override_style.css where we can apply CSS overrides
I fixed this, pls check. |
Tested mobile renderer output for bm.wikipedia.org: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the ZIM and it looks good in general, but the code needs IMO to be factored properly and partly simplified.
src/mwoffliner.lib.ts
Outdated
@@ -401,6 +404,10 @@ async function execute(argv: any) { | |||
logger.info('Copying Static Resource Files') | |||
await saveStaticFiles(config, zimCreator) | |||
|
|||
// TODO: refactor sequence, this only needed for mobile renderer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be indeed part of the mobilerenderer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static files handle only in src/mwoffliner.lib.ts, not in renders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is always the same kind of problem (like the CSS): code has to be factored properly. You have one place to save static files and only one, why not here. But the place to specify what are the static files to save that should be in the renderer. In addition it seems you save these static mobile files... all the time, even if they are not needed. which is not clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced modules handling to renderers themself. Now abstract desktop and abstract mobile have the ability to filter out necessary modules that come from Downloader. In the execution process now should be the exact modules we need.
1865aaf
to
a5d6edf
Compare
@VadimKovalenkoSNF Can you please rebase? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amost good, but IMO really problematic that the modules are not handled properly in the renderers. Same for "static" files!
res/templates/page.html
Outdated
|
||
__ARTICLE_CONFIGVARS_LIST__ | ||
__ARTICLE_JS_LIST__ | ||
__PCS_JS_OVERRIDE__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to override Mediawiki JS, then make a generic solution/naming to do that, but don't make it specific in particular with naming which is very Mediawiki specific (not MWoffliner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I replaced it with MW_MOBILE naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what I meant. There should be only one place to override CSS and not a placeholder for each usage. A reall good name should be something like __CSS_OVERRIDE__
or __JS_OVERRIDE__
... and inside you put whatever you want... here, for this end-point, the PCS related stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done by creating a separate template for desktop and mobile.
7ffc1e2
to
113ff0f
Compare
@VadimKovalenkoSNF Don't forget to add |
…m/mwoffliner into 1664-mobile-html-renderer
@VadimKovalenkoSNF As far as I can see, there is also a size problem. With this rendere, the ZIM file is almost and still 10x bigger than it should. Please compare the maxi versions (basically |
@kelson42 , I've noticed that ab wiki doesn't work as expected with mobile render. Though it has the support of |
@VadimKovalenkoSNF either this a bug by us and it has to be fixed or its a bug on wikimedia side and it has to be reported. If the backend is not able to deliver the content of an article, the whole scraper should stop with proper error. No tolerance to backend rendering errors if they concern a full article. |
I noticed that Upd: I created dedicated Phab ticket - https://phabricator.wikimedia.org/T348321 |
I'm not sure that the problem is with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VadimKovalenkoSNF If I got that right, this PR still needs to be fixed to have a better static content handling.
Yes, static file saving is in progress. |
LGTM but the js/css handling really needs to be revamped, should be handled in the renders. |
Fixes #1664
Fixes: #1916
Blocked by #1925